package com.cpd.blog.dto.User;

import com.cpd.blog.common.constant.Constant;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

/**
 * UserVo对象
 *
 * @author Copydown
 * @date 2022/05/07 00:34
 */
@Getter
@Setter
@ApiModel(description = "UserVo对象")
public class UserVo {

    @ApiModelProperty("用户 Id")
    private String id;

    @ApiModelProperty("用户 账号")
    private String account;

    @ApiModelProperty("用户名")
    private String nickname;

    @ApiModelProperty("用户头像路径")
    private String avatar;

    @ApiModelProperty("用户 邮箱")
    private String email;

    @JsonFormat(pattern = Constant.DATE_TIME_FORMAT, timezone = Constant.TIME_ZONE)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @ApiModelProperty("最近登录时间")
    private LocalDateTime lastLogin;

    @JsonFormat(pattern = Constant.DATE_TIME_FORMAT, timezone = Constant.TIME_ZONE)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @ApiModelProperty("注册时间")
    private LocalDateTime createTime;
}
